package com.corgi.mybatis.modules.mapping;

import com.corgi.mybatis.modules.domain.People;
import com.corgi.mybatis.modules.dto.PeopleDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @title: PeopleMapping
 * @description:
 * @author: dengmiao
 * @create: 2019-10-23 17:28
 **/
@Mapper(componentModel = "spring")
public interface PeopleMapping {

    /**
     * domain转化dto
     * @param people
     * @return
     */
    @Mappings({
            @Mapping(target = "sex", source = "gender"),
    })
    PeopleDto from(People people);

    /**
     * 可迭代的转化
     * @param people
     * @return
     */
    List<PeopleDto> fromList(List<People> people);
}
